home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre4.z / postgre4 / src / test / test_border.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  789 b   |  52 lines

  1. #include "border.c"
  2. /* $Header: /private/postgres/src/test/RCS/test_border.c,v 1.3 1989/09/05 16:54:05 mao Version_2 $ */
  3. static
  4. stack_print(sp)
  5.     stack *sp;
  6. {
  7.     for (;sp!=NULL;sp=sp->next)
  8.         printf(" -> %d",sp->datum);
  9.     putchar('\n');
  10. }
  11.  
  12. static
  13. bw_print()
  14. {
  15.     int i;
  16.     for (i=0;i<NDBUFS;i++) {
  17.         printf("[ %d ]", i);
  18.         stack_print(adjlist[i]);
  19.     }
  20.     putchar('\n');
  21. }
  22.  
  23. elog()
  24. {
  25.     printf("ERROR\n");
  26. }
  27.  
  28. main()
  29. {
  30.     struct dbufc    **order;
  31.     int        i;
  32.     static struct dbufc    *data[][2] = {
  33.         1, 2,
  34.         2, 3,
  35.         4,3,
  36.         3,5,
  37.         6,3,
  38.         1,7,
  39.         -1, -1
  40.         };
  41.     
  42.     bwinit();
  43.     for (i = 0; data[i][0]!=(struct dbufc *)(-1) && data[i][1]!=(struct dbufc *)(-1); i++) {
  44.         bworder(data[i][0], data[i][1]);
  45.         bw_print();
  46.     }
  47.     order = bwsort(datlist[2]);
  48.     for (i = 0; i < NDBUFS; i++)
  49.         printf("%d ", order[i]);
  50.     putchar('\n');
  51. }
  52.